package com.featherlike.feather.generator.impl;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.featherlike.feather.generator.Generator;
import com.featherlike.feather.generator.entity.Column;
import com.featherlike.feather.generator.entity.Table;
import com.featherlike.framework.common.util.StringUtil;

public class GeneratorMain {
	private static Logger logger = LoggerFactory.getLogger(GeneratorMain.class);

	public static void main(String[] args) throws Exception {
		Generator generator = GeneratorImpl.instance();
		if (StringUtil.isBlank(generator.getCfg().getPackageName())
				|| StringUtil.isBlank(generator.getCfg().getModuleName())
				|| StringUtil.isBlank(generator.getCfg().getFunctionName())) {
			logger.error("参数设置错误：包名、模块名、类名、功能名不能为空。");
			return;
		}
		Map<Table, List<Column>> tableMap = generator.getTableMapFromExcel();
		generator.generateAll(tableMap);
	}
}
